#include <iostream>
#include <vector>
using namespace std;

const int MOD = 1000000007;

void vectorSwap(vector<int> &arr, int i, int j) {
    int temp = arr[i];
    arr[i] = arr[j];
    arr[j] = temp;
}

void quickSort(vector<int> &arr, int left, int right) {
    if (left >= right) return;
    int sentry = arr[left];
    int i = left, j = right;
    while (i < j) {
        while (arr[j] >= sentry && i < j) j--;
        while (arr[i] <= sentry && i < j) i++;
        vectorSwap(arr, i, j);
    }
    vectorSwap(arr, left, i);
    quickSort(arr, left, i - 1);
    quickSort(arr, i + 1, right);
}

int main() {
    int T;
    cin >> T;
    while (T > 0) {
        int n;
        cin >> n;
        vector<int> mVector;
        for (int i = 0; i < n; ++i) {
            int temp;
            cin >> temp;
            mVector.emplace_back(temp);
        }
        quickSort(mVector, 0, n - 1);
        for (int i = n - 1; i > 0; --i) {
            for (int j = i - 1; j >= 0; --j) {
                mVector[j] = (mVector[j] + mVector[i]) % MOD;
            }
        }
        int result = 0;
        for (int i = 0; i < n; ++i) {
            result = (result + mVector[i]) % MOD;
        }
        cout << result << endl;
        T -= 1;
    }
    return 0;
}